PATHMac OS 8 and 9 Developer Documentation > Interapplication Communication > AppleScript for Scripters >

AppleScript Language Guide

   

Variable and Property Assignments and Declarations

Table A-12 summarizes the syntax for assigning values to variables and script properties and declaring local and global variables. For information about variables and script properties, see Values and Constants For detailed information about the scope of script variables and properties, see Scope of Script Variables and Properties.

Table A-12   Assignments and declarations  

Assignment or declaration

Syntax

Variable assignment
(and declaration if variable has not previously been declared)
copy expression to variable
copy reference to variable
set variable to expression
set variable to reference
Global variable declaration global variable [, variable ]...
Local variable declaration local variable [, variable ]...
Script property declaration and assignment property propertyLabel : expression
prop propertyLabel : expression

The Text Item Delimiters property, which is the only property you can get and set using the global variable AppleScript , consists of a list of the delimiters used by AppleScript when coercing lists to strings and when getting text items from strings. This property is declared by AppleScript and is available from any script. You can get and set this property with statements such as the following:

set savedDelimiters to AppleScript's text item delimiters
set AppleScript's text item delimiters to {":"}
get last text item of "Hard Disk:CD Contents:Release Notes"
--result: "Release Notes"
set AppleScript's text item delimiters to savedDelimiters

Currently, only the first delimiter in the list is used by AppleScript. For more information, see AppleScript Properties.


© 1999 Apple Computer, Inc. – (Last Updated 21 May 99)